// store/modules/publicInfo.js
const state = {
  userinfo: {username: '用户名'} // 用户信息
}
const getters = {
  username: state => state.userinfo.username
}

const mutations = {
  setUserInfo(state, userinfo) {
    state.userinfo = userinfo
  }
}

const actions = {
  // 如果需要异步操作可以在这里添加
  setUserInfo({commit}, userinfo) {
    commit('setUserInfo', userinfo)
  }
}


export default {
  namespaced: true, // 启用命名空间
  state,
  mutations,
  actions,
  getters
}
